# Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Contributor: Nick Østergaard <oe.nick@gmail.com>
# Contributor: Jonny Gerold <jonny@fsk141.com>

pkgname=viking
pkgver=1.10
pkgrel=2
pkgdesc="GTK application to manage GPS data"
arch=('loong64' 'x86_64')
url="https://sourceforge.net/projects/viking/"
license=('GPL2')
depends=('curl' 'file' 'gpsd' 'gtk3' 'libgexiv2' 'mapnik' 'geoclue' 'liboauth' 'libzip')
makedepends=('boost' 'docbook-xsl' 'intltool' 'itstool')
optdepends=('gpsbabel: import and export GPS tracks from various formats')
changelog=$pkgname.changelog
source=(https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2
        https://raw.githubusercontent.com/viking-gps/$pkgname/$pkgname-$pkgver/org.viking.Viking.appdata.xml)
sha256sums=('9455c895f98bc13de24bd6b234cd0f1d5ecdc1b068b4cbc6eb6644f6126e45ac'
            'f6dad8e63e49150e60e92243c08202dec20af2d453d38c18dd18ff95712b1885')

prepare() {
  sed -i 's/org.viking.Viking.desktop/viking.desktop/' org.viking.Viking.appdata.xml
}

build() {
  cd "${srcdir}"/$pkgname-$pkgver

  export CXXFLAGS="$CXXFLAGS -I/usr/include/mapnik"
  ./configure --prefix=/usr
  make
}

package(){
  cd "${srcdir}"/$pkgname-$pkgver

  make DESTDIR="${pkgdir}" install
  install -Dm644 ../org.viking.Viking.appdata.xml "${pkgdir}"/usr/share/metainfo/viking.appdata.xml
}
